package com.capgemini.teamtwo.service.impl;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.capgemini.teamtwo.entity.SysUser;
import com.capgemini.teamtwo.mapper.SysUserMapper;
import com.capgemini.teamtwo.service.SysUserService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * ClassName:SysUserServiceImpl <br/>
 * Description:todo <br/>
 * Date:2022/8/27 14:45 <br/>
 *
 * @author 徐志昂
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {


    @Override
    public void updateUserById(List<Integer> ids,String status,Integer projectId) {
        if (CollectionUtils.isNotEmpty(ids)) {
            List<SysUser> sysUserList = new ArrayList<>(ids.size());
            ids.forEach(userId -> {
                SysUser user = new SysUser();
                user.setId(userId);
                user.setStatus(status);
                user.setProjectId(projectId);
                sysUserList.add(user);
            });
            this.updateBatchById(sysUserList);
        }
    }

}